package com.example.seckillconsumer.utils;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * @author likaiping
 * @createTime 2024/7/6 20:58
 */
public class JedisUtil {
    private static JedisPool jedisPool = null;

    static {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxIdle(100);
        jedisPoolConfig.setMinIdle(10);
        JedisPool myJedisPool = new JedisPool();
        jedisPool = myJedisPool;
    }
    public static Jedis getJedis() {
        return jedisPool.getResource();
    }
}